{% extends "base.html" %}
{% load static %}

{% block title %}确认删除订阅{% endblock %}

{% block content %}
<div class="container mt-4">
    <div class="row">
        <div class="col-md-8 offset-md-2">
            <div class="card">
                <div class="card-header">
                    <h4 class="mb-0">确认删除订阅</h4>
                </div>
                <div class="card-body">
                    <p class="alert alert-warning">
                        您确定要删除以下订阅吗？此操作不可恢复。
                    </p>
                    
                    <div class="subscription-details mb-4">
                        <h5>订阅详情：</h5>
                        <ul class="list-unstyled">
                            <li><strong>数据源：</strong>{{ object.data_source.name }}</li>
                            {% if object.data_source.type == 'mqtt' %}
                                <li><strong>MQTT主题：</strong>{{ object.topic }}</li>
                            {% endif %}
                            <li><strong>节点ID：</strong>{{ object.node_id }}</li>
                            <li><strong>报警条件：</strong>{{ object.get_condition_display }}</li>
                            <li><strong>阈值：</strong>{{ object.threshold_value }}
                                {% if object.condition == 'range' %}
                                    - {{ object.threshold_max }}
                                {% endif %}
                                {{ object.unit }}
                            </li>
                            <li><strong>报警消息：</strong>{{ object.alert_message }}</li>
                            <li><strong>创建时间：</strong>{{ object.created_at|date:"Y-m-d H:i:s" }}</li>
                        </ul>
                    </div>

                    <form method="post">
                        {% csrf_token %}
                        <div class="d-flex justify-content-end">
                            <a href="{% url 'subscription_list' %}" class="btn btn-secondary me-2">
                                <i class="bi bi-x-circle"></i> 取消
                            </a>
                            <button type="submit" class="btn btn-danger">
                                <i class="bi bi-trash"></i> 确认删除
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 